﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Data.Entity;

namespace EF5
{
	public class User
	{
		[Key]
		public int UserId { get; set; }
		[Required, MinLength(3, ErrorMessage = "User Name must be more than 3 Charecters and less than 25 Charecters"),
		MaxLength(25)]
		public string UserName { get; set; }
		[Required, MinLength(6, ErrorMessage = "Password must be more than 6 Charecters and less than 25 Charecters"),
		MaxLength(40)]
		public string UserPassword { get; set; }
		[Required, MinLength(6, ErrorMessage = "Email must be more than 6 Charecters,less than 30 Charecters and meet proper email format"),
		MaxLength(30),
        RegularExpression(@"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)"+
                            @"*@(?:[a-z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?")]
		public string UserEmail { get; set; }


        [Required]
        public bool UserAcountLocked { get; set; }
        [Required]
        public bool UserPasswordReset { get; set; }
        public int FailedLoginAttempts { get; set; }
        public bool UserTutorialLanguagePrefrence { get; set; }


        public virtual List<AchievementEarned> AchievementEarneds { get; set; }
        public virtual List<Tutorial> Tutorials { get; set; } 
	}
}
